import auth
# 用户数据,登录之后存放
user_data = {
    'account_id': None,
    'is_authenticated': False,
    'account_data': None
}


# 程序入口:
def run():
    print("The programma is running")
    # 验证用户数据
    acc_data = auth.acc_login(user_data)
    if user_data['is_authenticated']:
        user_data['account_data'] = acc_data
        interactive(user_data)  # 交互

# 交互
def interactive(acc_data):
    '''
    interact with user
    :return:
    '''
    menu = u'''
    ------- Oldboy Bank ---------
    \033[32;1m1.  账户信息
    2.  还款(功能已实现)
    3.  取款(功能已实现)
    4.  转账
    5.  账单
    6.  退出
    \033[0m'''
    menu_dic = {
        # '1': account_info,
        # '2': repay,
        # '3': withdraw,
        # '4': transfer,
        # '5': pay_check,
        # '6': logout,
    }
    exit_flag = False
    while not exit_flag:
        print(menu)
        user_option = input(">>:").strip()
        if user_option in menu_dic:
            menu_dic[user_option](acc_data)

        else:
            print("\033[31;1mOption does not exist!\033[0m")